import request from "@/utils/request";
import type { hasTradeMrak,addOrUpdate } from "./type";

enum API {
    // 查询商品
    TRADEMARK_URL = "/admin/product/baseTrademark",
    // 保存商品
    ADDTRADEMARK_URL = "/admin/product/baseTrademark/save",
    // 更新
    UPDATETRADEMARK_URL = "/admin/product/baseTrademark/update",
    // 删除
    DELETETRADEMARK_URL = "/admin/product/baseTrademark/remove/",
}

export const getTrademark = (page: number, limit: number) =>
    request.get<any, hasTradeMrak>(API.TRADEMARK_URL + `/${page}/${limit}`);
;

export const addOrUpdateTradeMark = (data: addOrUpdate) => { 
    if (data.id) {
        return request.put<any,any>(API.UPDATETRADEMARK_URL, data);
    } else { 
        return request.post<any,any>(API.ADDTRADEMARK_URL,data)
    }
}

export const deleteTradeMark = (id: number) =>
    request.delete<any,any>(API.DELETETRADEMARK_URL+id)
